﻿#pragma once

typedef struct Snake Snake;
typedef struct SnakeBody SnakeBody;

typedef void (*SnakeDelete)(struct Snake*);
typedef void (*SnakeEat)(struct Snake*, struct SnakeBody*);
typedef BOOL (*SnakeMove)(struct Snake*);
typedef BOOL (*SnakePointIsOnMe)(struct Snake*, POINT);
typedef void (*SnakeTurn)(struct Snake*, UINT);

// 蛇
struct Snake {
    SnakeBody* mCauda;  // 蛇尾
    UINT mDirection;    // 移动方向
    SnakeBody* mHead;   // 蛇头

    SnakeDelete deleteSelf;
    SnakeEat eat;
    SnakeMove move;
    SnakePointIsOnMe pointIsOnMe;
    SnakeTurn turn;
};

Snake* New_Snake(HDC);
